package de.mhu.mandalaui.menu;

import de.mhu.mandalaui.Component;
import de.mhu.mandalaui.Response;
import de.mhu.mandalaui.StyleFilter;
import de.mhu.mandalaui.StyleFilter.FILTER;

public class MenuItem extends Component {

	private String label;
	private StyleFilter liFilter = new StyleFilter(this);
	private StyleFilter aFilter = new StyleFilter(this);
	
	public MenuItem() {
		liFilter.setEnabled(new FILTER[] {FILTER.CSS});
		liFilter.setDisabled(new FILTER[] {FILTER.CSS});
	}
	
	public MenuItem(String label) {
		setLabel(label);
	}
	
	@Override
	protected void doInitialize() {
	}

	@Override
	protected void doDestroy() {
	}

	@Override
	public void render(Response response) {
		response.startTag("li", null, liFilter);
		response.startTag("a", null, aFilter, "href", "#", "tabindex", "-1");
		if (label != null)
			response.appendText(label);
		response.endTag("a");
		response.endTag("li");
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

}
